With the popularization of the wireless local area network (WLAN), nearly all existing terminal devices have a WLAN access function, and wireless networks are deployed at more and more places.
However, currently most places with a wireless network need input of a password and authentication before use. For example, at places such as a restaurant, a cafe and so on, a user needs to ask a waiter for the password to access the network, for which an operation is complicated and an effect of the user experience is reduced.
An authentication method for a terminal device to access a wireless network is disclosed in the prior art. According to the method, the terminal device initiates, to an access point device (AP), a message carrying signal strength information of the terminal device, and the AP extracts the signal strength information in the message and calculates a signal attenuation value, compares the signal attenuation value obtained by calculation with a preset threshold; if the signal attenuation value is smaller than the preset threshold, the terminal device directly accesses the wireless network without authentication; and otherwise, the access is rejected.
The signal attenuation value obtained by calculation in the prior art is a signal attenuation value in an ideal environment, that is, interference of an obstacle or a wall in an actual environment is not considered, so that the signal attenuation value obtained by calculation is not accurate. In addition, signals transmitted by different terminal devices have different strength, which might result in failure of a terminal device, which is near an AP device but transmits a signal of weak strength, to access the wireless network, whereas a terminal device that is far away from the AP device but transmits a signal of strong strength may access the wireless network, which affects accuracy of authentication judgement.